#ifndef _COMPOSITE_H_
#define _COMPOSITE_H_

#include <list>

class Component
{
public:
    Component();
    virtual ~Component();
    virtual void Operation() = 0;
    virtual void Add(Component* pChild);
    virtual void Remove(Component* pChild);
    virtual Component* GetChild(int nIndex);
};

class Leaf : public Component
{
public:
    Leaf();
    virtual ~Leaf();
    virtual void Operation();
};

class Composite : public Component
{
public:
    Composite();
    virtual ~Composite();
    virtual void Operation();
    virtual void Add(Component* pChild);
    virtual void Remove(Component* pChild);
    virtual Component* GetChild(int nIndex);
private:
    std::list<Component*> _ListOfComponent;
};

#endif // _COMPOSITE_H_